package ord2.convert;

import ord2.core.Parameter;

/**
 * Exception that may be throw when a convert operation is performed.
 * @author José Ivan
 * @author Edviges
 */
public class ConvertException extends Exception {
    
    private static final long serialVersionUID = 1L;

    private final String name;
    private final Parameter[] parameters;
    
    /**
     * Creates a new instance of <code>ConvertException</code> that was throw
     * by converter with given name.
     */
    public ConvertException(String msg, String name) {
        
        this(msg, name, null);
    }

    /**
     * Constructs an instance of <code>ConvertException</code> with the
     * specified detail message and parameters used to perform the conversion.
     * @param msg the detail message.
     */
    public ConvertException(String msg, String name, Parameter[] par) {
        
        super(msg);
        this.name = name;
        this.parameters = par;
    }
    
    /**
     * Gets name of converter that throws this exception.
     * @return Converter name
     */
    public final String getName() {
        
        return this.name;
    }
    
    /**
     * Returns parameters used in convertion or null if none was used.
     * @return Array containing parameters used.
     */
    public final Parameter[] getParameters() {
        
        return this.parameters;
    }
}
